package edu.cuit.avatar.recursive;

import java.io.File;

/**
 * @author <a href="mailto:1020zhaodan@163.com">Adan</a>
 * @version 1.0
 * @date 2025/7/14 10:03
 */
public class DirectoryName {

    public static void printFileName(File file){
        if(file.isFile())
            System.out.println(file.getName()); //基础条件
        else if(file.isDirectory()){
            var files = file.listFiles();
            for(var i = 0; files != null && i < files.length; i++)
                printFileName(files[i]);
        }
    }

    public static void main(String[] args) {
        var file = new File("D:/workspace");
        printFileName(file);
    }
}
